home *** CD-ROM | disk | FTP | other *** search
/ Professional Soft Collection 1.02 / Professional Soft Collection 1.02.iso / bonusrus.os2 / infohway.cmd < prev    next >
OS/2 REXX Batch file  |  1995-05-16  |  4KB  |  145 lines

  1. /* **********************************************************************
  2. *  *               Copyright (c) IBM Corporation, 1994                  *
  3. *  *                       All Rights Reserved                          *
  4. *  **********************************************************************
  5. *
  6. *             IBM OS/2 Information Highway Desktop Setup Utility
  7. */
  8.  
  9.    /* Initalize Environment:
  10.    *  This command file combines all internet access applications on
  11.    *  the BonusPak for OS/2 into one workplace shell folder.
  12.    */
  13.    '@echo off'
  14.    trace off
  15.  
  16.    /* Parse Call Path Info
  17.    */
  18.    Parse Source . . callPath
  19.  
  20.    /* Load in function library
  21.    */
  22.    Call RxFuncAdd "SysLoadFuncs","RexxUtil","SysLoadFuncs"
  23.    Call SysLoadFuncs
  24.  
  25.    /* Strip program name
  26.    */
  27.    rcp = REVERSE(callPath)
  28.    callPathDir = REVERSE(substr(rcp,POS("\",rcp)+1))
  29.  
  30.    /* Create Queue to catch system error messages
  31.    */
  32.    rcode = RXQUEUE('delete', errq)
  33.    errq = RXQUEUE('create')
  34.    new = RXQUEUE('set', errq)
  35.  
  36.    /* Setup global variables
  37.    */
  38.    GV.InfoHwyIconText = "IBM Information"||"0D0A"X||"Superhighway"
  39.    GV.InfoHwyObjectID = "<InfoHighway>"
  40.    GV.InfoHwyLocation = "<WP_DESKTOP>"
  41.    GV.ObjectID.0      = 3
  42.    GV.ObjectID.1      = "<SampleApp>"       /* OS/2-CIM                 */
  43.    GV.ObjectID.2      = "<FPW_HALITE>"      /* HyperACCESS              */
  44.    GV.ObjectID.3      = "<IAK>"             /* Internet: After Reboot   */
  45.  
  46.    /* Define stem of icon files to be copied
  47.    */
  48.    MaxCopyIndex = 4
  49.    Files. = ""
  50.    Files.0 = MaxCopyIndex
  51.    Files.1 = "INFOHWY1.ICO"
  52.    Files.2 = "INFOHWY2.ICO"
  53.    Files.3 = "INET1.ICO"
  54.    Files.4 = "INET2.ICO"
  55.  
  56.    /* Verify Source Files
  57.    */
  58.    do i = 1 to MaxCopyIndex
  59.      rc = VerifySourcePath( callPathDir||'\'||Files.i )
  60.      if ( rc == 1 ) then
  61.        call Done
  62.    end
  63.  
  64.    /* Is a SuperHighway folder needed?
  65.    *  Are any of the SuperHighway applications installed?
  66.    */
  67.    fSH_Appl_Exists = 0
  68.    do z = 1 to GV.ObjectID.0
  69.      rc = ObjectExists(GV.ObjectID.z)
  70.      fSH_Appl_Exists = fSH_Appl_Exists + rc
  71.    end
  72.    if (fSH_Appl_Exists == 0) then
  73.      signal Done
  74.  
  75.    /* Create Information Highway Folder
  76.    */
  77.    classname = 'WPFolder'
  78.    title     = GV.InfoHwyIconText
  79.    location  = GV.InfoHwyLocation
  80.    setup     = 'OBJECTID='GV.InfoHwyObjectID';'||,
  81.                'ICONFILE='||callPathDir||'\'||Files.3||';'||,
  82.                'ICONNFILE=1,'||callPathDir||'\'||Files.4||';'
  83.  
  84.    rc = SysCreateObject(classname, title, location, setup, 'f')
  85.  
  86.    /* Move Information Highway Applications to Information Highway Folder
  87.    */
  88.    do z = 1 to GV.ObjectID.0
  89.      rc = SysMoveObject(GV.ObjectID.z,GV.InfoHwyObjectID)
  90.    end
  91.  
  92.    /* Open Information Highway Folder
  93.    */
  94.    object    = GV.InfoHwyObjectID
  95.    setup     = 'OPEN=DEFAULT'
  96.    rc = SysSetObjectData(object, setup)
  97.  
  98. Done:
  99.    rc = RXQUEUE('delete', errq)
  100.    exit
  101.  
  102. /* Procedures and Functions
  103. */
  104.  
  105. VerifySourcePath: Procedure Expose errq
  106.  
  107.    Parse Arg file;
  108.  
  109.    fExists = Stream(file,'c','query exists')
  110.    if (fExists == "")
  111.      then do
  112.            'helpmsg SYS002 | RXQUEUE 'errq
  113.             call DumpErrMsg
  114.             return 1
  115.           end
  116.  
  117. return 0
  118.  
  119. DumpErrMsg: Procedure
  120.  
  121.    do while(QUEUED() \= 0)
  122.      parse pull line
  123.      if (POS("SYS",line) \= 0) then
  124.        fFound = 1
  125.      if ((line == "") & (fFound = 1)) then
  126.        do
  127.          /* Empty out queue
  128.          */
  129.          do while(QUEUED() \= 0)
  130.            parse pull line
  131.          end
  132.          leave
  133.        end
  134.      say line
  135.    end
  136.  
  137. return
  138.  
  139. ObjectExists: procedure
  140.  
  141.     parse arg Object
  142.     rc = SysSetObjectData(Object,"NODELETE=NO")
  143.  
  144. return rc
  145.